package com.spring;

import com.spring.bean.Person;
import com.spring.config.MainConfig;
import com.spring.config.MainConfig2;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Description:
 *
 * @author lijie
 * @create 2019-01-14 23:22
 * Update by lijie 2019-01-14 23:22
 */
public class MainTest {
    public static void main(String[] args) {
        //ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        ApplicationContext context = new AnnotationConfigApplicationContext(MainConfig2.class);
        System.out.println("容器初始化完成...");
        //Person person = (Person)context.getBean(Person.class);
//        System.out.println(person);
//        String[] names = context.getBeanNamesForType(Person.class);
//        for(int i=0;i<names.length;i++){
//            System.out.println(names[i]);
//        }
//        System.out.println(person.hashCode());
//        Person person2 = (Person)context.getBean(Person.class);
//        System.out.println(person == person2);
    }
}
